package com.api.shopapi.mapper;

import com.api.shopapi.entity.ServeStaffRel;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface ServeStaffRelMapper {

    @Insert("insert into serve_staff_rel " +
            "(" +
            "ServeStaffRelCode, " +
            "ServeCode, " +
            "StaffCode" +
            ") " +
            "VALUES (#{serveStaffRel.ServeStaffRelCode} ," +
            "#{serveStaffRel.ServeCode} ," +
            "#{serveStaffRel.StaffCode} )")
    int insert(@Param("serveStaffRel") ServeStaffRel serveStaffRel);


    @Update("update serve_staff_rel set " +
            "ServeCode=#{serveStaffRel.ServeCode} ," +
            "StaffCode=#{serveStaffRel.StaffCode}  " +
            "where ServeStaffRelCode=#{serveStaffRel.ServeStaffRelCode}    ")
    int update(@Param("serveStaffRel") ServeStaffRel serveStaffRel);


    @Select("select  * from  serve_staff_rel where ServeStaffRelCode=#{serveStaffRelCode} limit 1 ")
    ServeStaffRel getByServeStaffRelCode(@Param("serveStaffRelCode") String serveStaffRelCode);

    @Select("select * from serve_staff_rel where StaffCode=#{staffCode} limit 1 ")
    ServeStaffRel getByStaffCode(@Param("staffCode") String staffCode);

    @Select("select  * from  serve_staff_rel where ServeCode=#{serveCode}  limit 1 ")
    ServeStaffRel getByServeCode(@Param("serveCode") String serveCode);

    @Delete("delete  from serve_staff_rel where ServeStaffRelCode=#{serveStaffRelCode}")
    int delete(@Param("serveStaffRelCode") String serveStaffRelCode);





}
